﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Agresso.Interface.Layer.Domain
{
    public class FreightCommisionInvoice
    {
        private InvoiceType m_Type;
        private string m_ChargeCharterer;
        private string m_Department;
        private string m_VesselName;
        private DateTime m_Date;
        private string m_ChargeDescription;
        private decimal m_ChargeAmount;
        private string m_Currency;
        private string m_Number;
        private DateTime m_DueDate;
        private ChargeType m_ChargeType;

        public FreightCommisionInvoice() { }
        public FreightCommisionInvoice(SqlDataReader rd) 
        {
            m_Type = (InvoiceType)Enum.Parse(typeof(InvoiceType), rd["Type"].ToString().Trim().Replace(" ", string.Empty));
            m_ChargeCharterer = rd["Charge_Charterer"].ToString();
            m_Department = rd["Profit_Centre_Fullname"].ToString();
            m_VesselName = rd["Vessel_Name"].ToString();
            m_Date = Convert.ToDateTime(rd["Date"].ToString());
            m_ChargeDescription = rd["Charge_Description"].ToString();
            m_ChargeAmount = Convert.ToDecimal(rd["Charge_Amount"]);
            m_Currency = rd["Currency"].ToString();
            m_Number = rd["Number"].ToString();
            string dd = rd["Due_Date"].ToString(); // DUE DATE CAN BE NULL DATE
            if (dd != string.Empty) m_DueDate = Convert.ToDateTime(rd["Due_Date"].ToString());
            m_ChargeType = (ChargeType)Enum.Parse(typeof(ChargeType), rd["Charge_Type"].ToString().Trim().Replace(" ", string.Empty));
        }
        #region Properties
        public InvoiceType Type
        {
            get { return m_Type; }
            set { m_Type = value; }
        }
        public string ChargeCharterer
        {
            get { return m_ChargeCharterer; }
            set { m_ChargeCharterer = value; }
        }
        public string Department
        {
            get { return m_Department; }
            set { m_Department = value; }
        }
        public string VesselName
        {
            get { return m_VesselName; }
            set { m_VesselName = value; }
        }
        public DateTime Date
        {
            get { return m_Date; }
            set { m_Date = value; }
        }
        public string ChargeDescription
        {
            get { return m_ChargeDescription; }
            set { m_ChargeDescription = value; }
        }
        public decimal ChargeAmount
        {
            get { return m_ChargeAmount; }
            set { m_ChargeAmount = value; }
        }
        public string Currency
        {
            get { return m_Currency; }
            set { m_Currency = value; }
        }
        public string Number
        {
            get { return m_Number; }
            set { m_Number = value; }
        }
        public DateTime DueDate
        {
            get { return m_DueDate; }
            set { m_DueDate = value; }
        }
        public ChargeType ChargeType
        {
            get { return m_ChargeType; }
            set { m_ChargeType = value; }
        }
        #endregion
        #region Methods
        
        #endregion
    }
}
